home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / science / sm32a.zip / LIBRARY / PARAPLOT.LI < prev    next >
Text File  |  1994-12-22  |  788b  |  21 lines

  1. # library paraPlot
  2. # paraplot() plots parametric curves of x=fx(t) and y=fy(t) on xy-plane.
  3. # by default tmin:=0, tmax:=2*pi, ymin:=-5, ymax:=5, xmin:=ymin, xmax:=ymax
  4. # e.g. paraplot(sin(t),sin(2*t), t)    # x=sin(t), y=sin(2*t)
  5.  
  6. paraplot(fx_, fy_, t_, tmin_, tmax_, ymin_, ymax_) := block(numeric:=on,
  7.     dt:=(tmax-tmin)/getmaxx,
  8.     tstep:=dt*10,
  9.     dx:=(ymax-ymin)/getmaxx,
  10.     dy:=(ymax-ymin)/getmaxy,
  11.     axis(ymin,ymax,ymin,ymax),
  12.     setcolor(colorno(green)),
  13.     moveto((subs(fx,t=tmin)-ymin)/dx,getmaxy-(subs(fy,t=tmin)-ymin)/dy),
  14.     do( lineto((fx-ymin)/dx,getmaxy-(fy-ymin)/dy),
  15.     t,tmin,tmax,tstep),
  16.     numeric:=off,
  17.     readchar,
  18.     local(dt,dx,dy,tstep))
  19. paraplot(fx_, fy_, t_, tmin_, tmax_) := paraplot(fx,fy,t,tmin,tmax,-5,5)
  20. paraplot(fx_, fy_, t_) := paraplot(fx,fy,t,0,2*pi,-5,5)
  21.